using System;
using System.Collections.Generic;
using System.Text;
using System.CodeDom.Compiler;
using SharpMud.Server.Systems.Scripting.Processing;
using SharpMud.Server.Systems.Scripting.Processing.Source;

namespace SharpMud.Server.Systems.Scripting
{
    /// <summary>
    /// A utility for acquiring various script handles based on varying types of sources.
    /// </summary>
    internal static class ScriptSourceProvider
    {
        public static IScriptSourceHandle FromFile(System.IO.FileInfo scriptFile, IScriptCompileContext scriptCompileContext)
        {
            return new FileScriptSource(scriptFile, scriptCompileContext);
        }

        internal static HashWrapper HashScriptCode(string code)
        {
            System.Security.Cryptography.HashAlgorithm hashAlgorithm;
            hashAlgorithm = new System.Security.Cryptography.SHA256Managed();

            return HashWrapper.Hash(hashAlgorithm, code);
        }
    }
}
